
/******************************************************************************\
|    Title:        	 TABLE1: Regression Models for Becoming a Lobbyist		   |
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/


clear all
set more off, permanently
numlabel, add
set maxvar 32000

use congress_yearly.dta, clear
xtset stafferid year

*******************************************
** 2008-2016

xtreg lobbydirectafter switchtouncovered_treatment i.year if posttreat==1, fe vce(cluster stafferid) 
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model1
estadd local fixed "Yes" , replace

	
xtreg lobbydirectafter switchtouncovered_treatment daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear ///
	dcoffice_everyear leaderofficestaff_everyear i.year if posttreat==1, fe cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model2
estadd local fixed "Yes" , replace


xtreg lobbydirectafter switchtouncovered_treatment daysworked experience_imp experience_sq committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear ///
	dcoffice_everyear leaderofficestaff_everyear i.year if posttreat==1, fe cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model3
estadd local fixed "Yes" , replace


*******************************************
** 2007-2016


xtreg lobbydirectafter switchtouncovered_treatment i.year if posttreat==1 | year==2007, fe cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean)
est store model1b
estadd local fixed "Yes" , replace

xtreg lobbydirectafter switchtouncovered_treatment daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear ///
	dcoffice_everyear leaderofficestaff_everyear i.year if posttreat==1 | year==2007, fe cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model2b
estadd local fixed "Yes" , replace

	
xtreg lobbydirectafter switchtouncovered_treatment daysworked experience_imp experience_sq committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear ///
	dcoffice_everyear leaderofficestaff_everyear i.year if posttreat==1 | year==2007, fe cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model3b
estadd local fixed "Yes" , replace


esttab model1 model2 model3 model1b model2b model3b using "TABLE1.csv", replace ///
	b(3) se(3) star(* .05 ** .01 *** 0.001) ///
	stats(fixed ymean N N_g r2, fmt(0 3 0 0 3) labels("Staffer FE" "Mean of DV"  "Observations" "Number of staffers" "R2"))  ///
	nomtitles mgroups("2008-2016" "2007-2016", pattern(1 0 0 1 0 0)) ///
	coeflabels(switchtouncovered_treatment "Switch to uncovered" daysworked "Days worked" experience_imp "Hill experience" experience_sq "Hill experience sq." committeestaff_everyear "Committee staff" personalstaff_everyear "Personal staff" senate_everyear "Senate staff" majority_everyear "Majority party staff" minority_everyear "Minority party staff" dcoffice_everyear "DC office staff" leaderofficestaff_everyear "Leadership office staff") ///
    label parentheses nogaps nolines noeqlines ///
    noomitted nodepvars nobaselevels indicate("Year FE = *.year") nonotes noconstant
	

